// Message_api.js - 修正版本
import http from '../util/request.js'

export default {
    // 获取用户消息列表
    getMessages: (receiverId, page = 1, limit = 10) => {
        return http({
            url: '/api/messages/list',
            method: 'get',
            params: { receiverId, page, limit }
        })
    },

    // 按类型获取用户消息列表
    getMessagesByType: (receiverId, msgType, page = 1, limit = 10) => {
        return http({
            url: '/api/messages/listByType',
            method: 'get',
            params: { receiverId, msgType, page, limit }
        })
    },

    // 标记消息为已读
    markAsRead: (ids) => {
        return http({
            url: '/api/messages/markAsRead',
            method: 'post',
            data: ids
        })
    },


    // 删除消息
    deleteMessage: (id) => {
        return http({
            url: '/api/messages/delete/'+id,
            method: 'delete'
        })
    }
}